<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改广告投放')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-advertising-edit" th:object="${advertising}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">选择广告：</label>
<!--                <div class="col-sm-8">-->
<!--                    <input name="advertId" th:field="*{advertId}" class="form-control" type="text" required>-->
<!--                </div>-->
                <div class="col-sm-8">
                    <select name="advertId" class="form-control m-b" th:with="type=${@jiaqinAdvertServiceImpl.selectAll()}" required>
                        <option th:each="dict : ${type}" th:text="${dict.title}" th:value="${dict.id}" th:field="*{advertId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">投放位置：</label>
                <div class="col-sm-8">
                    <select name="putAddr" class="form-control m-b" th:with="type=${@dict.getType('advert_put_addr')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{putAddr}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">排序：</label>
                <div class="col-sm-8">
                    <input name="sort" th:field="*{sort}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">投放时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="putAt" th:value="${#dates.format(advertising.putAt, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "jiaqin/advertising";
        $("#form-advertising-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-advertising-edit').serialize());
            }
        }

        $("input[name='putAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>
